<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/22
 * Time: 10:09
 */

namespace app\index\controller;


use think\Request;

class SetUp extends Base
{
    private $SetUp;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->SetUp = new \app\index\model\SetUp();
    }

    public function index()
    {
        $list = $this->SetUp->find();
        $this->assign('data', $list);
        return $this->fetch();
    }

    public function save()
    {
        $data = input('post.');
        $data['update_time'] = time();
        if($this->SetUp->allowField(true)->save($data,['id'=>$data['id']])){
            $r = resposer('修改成功',1);
        }else{
            $r = resposer('修改失败',0);
        }
        return $r;
    }
}